home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / xfs / libxlog.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-04  |  4.6 KB  |  134 lines

  1. /*
  2.  * Copyright (c) 2000-2005 Silicon Graphics, Inc.All Rights Reserved.
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU General Public License as
  6.  * published by the Free Software Foundation.
  7.  *
  8.  * This program is distributed in the hope that it would be useful,
  9.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.  * GNU General Public License for more details.
  12.  *
  13.  * You should have received a copy of the GNU General Public License
  14.  * along with this program; if not, write the Free Software Foundation,
  15.  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  16.  */
  17. #ifndef LIBXLOG_H
  18. #define LIBXLOG_H
  19.  
  20. #include <xfs/libxfs.h>
  21.  
  22. /*
  23.  * define the userlevel xlog_t to be the subset of the kernel's
  24.  * xlog_t that we actually need to get our work done, avoiding
  25.  * the need to define any exotic kernel types in userland.
  26.  */
  27. typedef struct log {
  28.     xfs_lsn_t    l_tail_lsn;     /* lsn of 1st LR w/ unflush buffers */
  29.     xfs_lsn_t    l_last_sync_lsn;/* lsn of last LR on disk */
  30.     xfs_mount_t    *l_mp;            /* mount point */
  31.     dev_t        l_dev;            /* dev_t of log */
  32.     xfs_daddr_t    l_logBBstart;   /* start block of log */
  33.     int        l_logsize;      /* size of log in bytes */
  34.     int        l_logBBsize;    /* size of log in 512 byte chunks */
  35.     int        l_curr_cycle;   /* Cycle number of log writes */
  36.     int        l_prev_cycle;   /* Cycle # b4 last block increment */
  37.     int        l_curr_block;   /* current logical block of log */
  38.     int        l_prev_block;   /* previous logical block of log */
  39.     int        l_iclog_size;     /* size of log in bytes */
  40.     int        l_iclog_size_log;/* log power size of log */
  41.     int        l_iclog_bufs;     /* number of iclog buffers */
  42.     int        l_grant_reserve_cycle;    /* */
  43.     int        l_grant_reserve_bytes;    /* */
  44.     int        l_grant_write_cycle;    /* */
  45.     int        l_grant_write_bytes;    /* */
  46.     uint        l_sectbb_log;   /* log2 of sector size in bbs */
  47.     uint        l_sectbb_mask;  /* sector size (in BBs)
  48.                      * alignment mask */
  49. } xlog_t;
  50.  
  51. #include <xfs/xfs_log_recover.h>
  52. #include <xfs/xfs_buf_item.h>
  53. #include <xfs/xfs_inode_item.h>
  54. #include <xfs/xfs_extfree_item.h>
  55.  
  56. typedef union {
  57.     xlog_rec_header_t       hic_header;
  58.     xlog_rec_ext_header_t   hic_xheader;
  59.     char                    hic_sector[XLOG_HEADER_SIZE];
  60. } xlog_in_core_2_t;
  61.  
  62. /*
  63.  * macros mapping kernel code to user code
  64.  */
  65. #ifndef EFSCORRUPTED
  66. #define EFSCORRUPTED             990
  67. #endif
  68. #define STATIC                static
  69. #define XFS_ERROR(e)            (e)
  70. #ifdef DEBUG
  71. #define XFS_ERROR_REPORT(e,l,mp)    fprintf(stderr, "ERROR: %s\n", e)
  72. #else
  73. #define XFS_ERROR_REPORT(e,l,mp)    ((void) 0)
  74. #endif
  75. #define XFS_CORRUPTION_ERROR(e,l,mp,m)    ((void) 0)
  76. #define XFS_MOUNT_WAS_CLEAN        0x1
  77. #define unlikely(x)            (x)
  78. #define min(a,b)            ((a) < (b) ? (a) : (b))
  79.  
  80. extern void xlog_warn(char *fmt,...);
  81. extern void xlog_exit(char *fmt,...);
  82. extern void xlog_panic(char *fmt,...);
  83.  
  84. #define kmem_zalloc(size, foo)            calloc(size,1)
  85. #define kmem_alloc(size, foo)            calloc(size,1)
  86. #define kmem_free(ptr, foo)            free(ptr)
  87. #define kmem_realloc(ptr, len, old, foo)    realloc(ptr, len)
  88.  
  89. /* exports */
  90. extern int    print_exit;
  91. extern int    print_skip_uuid;
  92. extern int    print_record_header;
  93.  
  94. /* libxfs parameters */
  95. extern libxfs_init_t    x;
  96.  
  97. extern struct xfs_buf *xlog_get_bp(xlog_t *, int);
  98. extern void     xlog_put_bp(struct xfs_buf *);
  99. extern int     xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *);
  100.  
  101. extern int  xlog_find_zeroed(xlog_t *log, xfs_daddr_t *blk_no);
  102. extern int  xlog_find_cycle_start(xlog_t *log, xfs_buf_t *bp,
  103.         xfs_daddr_t first_blk, xfs_daddr_t *last_blk, uint cycle);
  104. extern int  xlog_find_tail(xlog_t *log, xfs_daddr_t *head_blk,
  105.         xfs_daddr_t *tail_blk, int readonly);
  106.  
  107. extern int  xlog_test_footer(xlog_t *log);
  108. extern int  xlog_recover(xlog_t *log, int readonly);
  109. extern void xlog_recover_print_data(xfs_caddr_t p, int len);
  110. extern void xlog_recover_print_logitem(xlog_recover_item_t *item);
  111. extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
  112. extern int  xlog_print_find_oldest(xlog_t *log, xfs_daddr_t *last_blk);
  113.  
  114. /* for transactional view */
  115. extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
  116.  
  117. extern void xlog_recover_print_trans(    xlog_recover_t        *trans,
  118.                     xlog_recover_item_t    *itemq,
  119.                     int            print);
  120.  
  121. extern int  xlog_do_recovery_pass(    xlog_t        *log,
  122.                     xfs_daddr_t    head_blk,
  123.                     xfs_daddr_t    tail_blk,
  124.                     int        pass);
  125. extern int  xlog_recover_do_trans(    xlog_t        *log,
  126.                     xlog_recover_t    *trans,
  127.                     int        pass);
  128. extern int  xlog_header_check_recover(  xfs_mount_t         *mp,
  129.                     xlog_rec_header_t   *head);
  130. extern int  xlog_header_check_mount(    xfs_mount_t         *mp,
  131.                     xlog_rec_header_t   *head);
  132.  
  133. #endif    /* LIBXLOG_H */
  134.